Precise Garbage Collection in Prolog
نویسندگان
چکیده
In this paper we present a series of tiny programs that verify that a Prolog heap garbage collector can find specific forms of garbage. Only 2 out of our tested 7 Prolog systems pass all tests. Comparing memory usage on realistic programs dealing with finite datastructures using both poor and precise garbage collection shows only a small difference, providing a plausible explanation why many Prolog implementors did not pay much attention to this issue. Attributed variables allow for creating infinite lazy datastructures. We prove that such datastructures have great practical value and their introduction requires ‘precise’ garbage collection. The Prolog community knows about three techniques to reach at precise garbage collection. We summarise these techniques and provide more details on scanning virtual machine instructions to infer reachability in a case study.
منابع مشابه
Uppsala Theses in Computing Science 26 Compilation Techniques for Prolog Compilation Techniques for Prolog
Current Prolog compilers are largely limited to optimizing a single predicate at a time. We propose two methods to express the global control of Prolog programs. The rst method transforms a Prolog program into a continuation-passing style, where all operations have explicit success and failure continuations. The second method directly constructs a control ow graph from the Prolog program. This ...
متن کاملCopying garbage collection for WAM-based prolog systems
High-level programming languages like Prolog free the programmer from the burden of explicit memory management. In Prolog, dynamic memory allocation is done implicitly by creating data structures. The deallocation of data structures which are no longer in use, is the responsibility of the run-time system. Many Prolog implementations are based on the Warren Abstract Machine (WAM), a virtual mach...
متن کاملGarbage Collection for Prolog based on Twin Cells
A garbage collection algorithm for a WAM-based Prolog system is presented. It uses a classical mark-and-compact approach, but requires less passes through the data areas than previous algorithms. It is applicable when the smallest garbage-collectable entity occupies an amount of space which is suucient to store two pointers plus 2 bits with each pointer. This collector has been implemented in t...
متن کاملLock-free atom garbage collection for multithreaded Prolog - ERRATUM
The runtime system of dynamic languages such as Prolog or Lisp and their derivatives contain a symbol table, in Prolog often called the atom table. A simple dynamically resizing hash-table used to be an adequate way to implement this table. As Prolog becomes fashionable for 24×7 server processes we need to deal with atom garbage collection and concurrent access to the atom table. Classical lock...
متن کاملA Simple and Efficient Copying Garbage Collector for Prolog
We show how to implement eecient copying garbage collection for Prolog. We measure the eeciency of the collector compared to a standard mark-sweep algorithm on several programs. We then show how to acco-modate generational garbage collection and Prolog primitives that make the implementation more diicult. The resulting algorithms are simpler and more eecient than the standard mark-sweep method ...
متن کامل